import React, { Component } from 'react';
import axios from 'axios';
const Connect = (MyComponent) => {
  return class extends Component {
    constructor(props) {
      super(props);
      this.state = {
        data: [],
      };
    }
    componentWillMount() {
      axios.get('/cahloanapp/index/contentList.do')
        .then(res => res.data)
        .then(data => {
          this.setState({
            data: data.result
          });
        })
    }
    render() {
      return <MyComponent { ...this.props } data={this.state.data} />
    }
  }
}

const Banner = (MyComponent) => {
  return class extends Component {
    constructor(props) {
      super(props);
      this.state = {
        data: [],
      };
    }
    componentWillMount() {
      axios.get('/cahloanapp/index/contentList.do')
        .then(res => res.data)
        .then(data => {
          
          this.setState({
            data: data.result.resultBannarList
          });
        })
    }
    render() {
      return <MyComponent { ...this.props } data={this.state.data} />
    }
  }
}
export {
  Connect,Banner
}